package leecode.stringAndArray.summary;

import java.util.Arrays;

public class MoveZeroes {
    public static void main(String[] args) {
        moveZeroes(new int[]{0,1,0,3,12});
    }

    public static void moveZeroes(int[] nums) {
        int left=0;
        int right=0;
        while (right<nums.length){
            if(nums[right]!=0){
                nums[left++]=nums[right];
            }
            right++;
        }
        for (;left<nums.length;left++){
            nums[left]=0;
        }
        System.out.println(Arrays.toString(nums));
    }

}
